import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home/index",
  },
  {
    path:'/home',
    component:HomeView,
    children:[{
      path:'index',
      component:() => import('../views/Index.vue'),
    meta:{
      thumbs:['首页']
    }
    },{
      path: 'gym-list',
      component: () => import('../views/gym/GymList.vue'),
      meta: {
        thumbs:['健身房管理','健身房列表']
      }
    },{
      path: 'gym-add',
      component: () => import('../views/gym/GymAdd.vue'),
      meta: {
        thumbs:['健身房管理','新增健身房']
      }
    },{
      path: 'gym-update',
      component: () => import('../views/gym/GymUpdate.vue'),
      meta: {
        thumbs: [
          '健身房管理', 
          {name:'健身房列表', to:'/home/gym-list'}, 
          '修改健身房信息']
      }
    },{
      path: 'course-list',
      component: () => import('../views/course/CourseList.vue'),
      meta: {
        thumbs:['课程管理','课程列表']
      }
    },{
      path: 'course-video',
      component: () => import('../views/course/courseVideo.vue'),
      meta: {
        thumbs:['课程管理','课程列表','课程视频']
      }
    },{
      path: 'course-update',
      component: () => import('../views/course/CourseUpdate.vue'),
      meta:{
        thumbs:['课程管理','课程列表','修改课程']
      }
    },
    {
      path: 'course-add',
      component: () => import('../views/course/CourseAdd.vue'),
      meta: {
        thumbs:['课程管理','新增课程']
      }
    },{
      path: 'product-list',
      component: () => import('../views/mall/ProductList.vue'),
      meta: {
        thumbs:['商城管理','商品列表']
      }
    },{
      path: 'product-add',
      component: () => import('../views/mall/ProductAdd.vue'),
      meta: {
        thumbs:['商城管理','新增商品']
      }
    },{
      path: 'user-list',
      component: () => import('../views/user/UserList.vue'),
      meta: {
        thumbs:['用户管理','用户列表']
      }
    },{
      path: 'user-management',
      component: () => import('../views/user/UserManagement.vue'),
      meta: {
        thumbs:['用户管理','管理用户']
      }
    },{
      path: 'coach-list/:store_id',
      component: () => import('../views/coach/CoachList.vue'),
      meta: {
        thumbs:['教练管理','教练列表']
      }
    }, {
      path: 'coach-update',
      component: () => import('../views/coach/CoachUpdate.vue'),
      meta:{
        thumbs:['教练管理',{name:'教练列表',to:'/home/coach-list'},'修改教练信息']
      }
    },{
      path: 'plesson-list',
      component: () => import('../views/personal-lesson/PLessonList.vue'),
      meta:{
        thumbs:['教练管理','教练列表','私教课程列表']
      }
    },
    {
      path: 'plesson-update',
      component: () => import('../views/personal-lesson/PLeesonUpdate.vue'),
      meta:{
        thumbs:['教练管理','教练列表','私教课程列表','修改私教课程信息']
      }
    },
    {
      path: 'trends-list',
      component: () => import('../views/trends/TrendsList.vue'),
      meta:{
        thumbs:['动态管理','动态列表']
      }
    },{
      path: 'subject-list',
      component: () => import('../views/subject/SubjectList.vue'),
      meta:{
        thumbs:['专题管理','专题列表']
      }
    },{
      path: 'subject-add',
      component: () => import('../views/subject/AddSubject.vue'),
      meta:{
        thumbs:['专题管理','新增专题']
      }
    },{
      path: 'videolesson-list',
      component: () => import('../views/subject/VideoLessonList.vue'),
      meta:{
        thumbs:['专题管理','专题列表','视频课程列表']
      }
    },
    {
      path: 'videolesson-add',
      component: () => import('../views/subject/AddVideoLesson.vue'),
      meta:{
        thumbs:[ '专题管理','专题列表','新增视频课程']
      }
    },{
      path: 'product-modify',
      component: () => import('../views/mall/ProductModify.vue'),
      meta:{
        thumbs:['商城管理','商品列表','修改商品信息']
      }
    },
  ]
  },
  {
    path: '/admin/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import('../views/admin/Login.vue'),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
